<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>一键统计</title>
    <?php echo $this->mview->getPartial('layouts/_meta') ?>
    <style>
        .w80 {
            width: 80%;
        }

        .table-bordered > thead > tr > th, .table-bordered > tbody > tr > th, .table-bordered > tfoot > tr > th, .table-bordered > thead > tr > td, .table-bordered > tbody > tr > td, .table-bordered > tfoot > tr > td {
            border: 1px solid #d2d6de;
        }

        .modal-dialog {
            position: absolute;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
        }

        .modal-content {
            /*overflow-y: scroll; */
            position: absolute;
            top: 0;
            bottom: 0;
            width: 100%;
        }

        .modal-body {
            overflow-y: scroll;
            position: absolute;
            top: 55px;
            bottom: 65px;
            width: 100%;
        }

        .modal-header .close {
            margin-right: 15px;
        }

        .modal-footer {
            position: absolute;
            width: 100%;
            bottom: 0;
        }
    </style>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <?php echo $this->mview->getPartial('layouts/_header') ?>

    <?php echo $this->mview->getPartial('layouts/_sidebar') ?>

    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header"></section>
        <!-- Main content -->
        <section class="content container-fluid">
            <div class="rt">
                <div class="w80 center-block">
                    <!-- table start -->
                    <table class="table table-responsive table-hover table-bordered">
                        <tr>
                            <th>序号</th>
                            <th>公司名称</th>
                            <th>员工数</th>
                            <th>会员数</th>
                            <th>产品数</th>
                        </tr>
                        <?php
                        if (isset($datas)) {
                            $i = 1;
                            foreach ($datas['items'] as $item) {
                                ?>
                                <tr>
                                    <td><?php echo $i; ?></td>

                                    <td><?php echo $item['company']['name']; ?></td>

                                    <?php if ($item['users']['count'] === 0) { ?>
                                        <td><?php echo $item['users']['count']; ?></td>
                                    <?php } else { ?>
                                        <td><a href="javascript:void(0);" data-name="user"
                                               data-value='<?php echo json_encode($item['users']['details']); ?>'
                                               onclick="showdetails(this);"><?php echo $item['users']['count']; ?></a>
                                        </td>
                                    <?php } ?>

                                    <?php if ($item['members']['count'] === 0) { ?>
                                        <td><?php echo $item['members']['count']; ?></td>
                                    <?php } else { ?>
                                        <td><a href="javascript:void(0);" data-name="member"
                                               data-value='<?php echo json_encode($item['members']['details']); ?>'
                                               onclick="showdetails(this);"><?php echo $item['members']['count']; ?></a>
                                        </td>
                                    <?php } ?>

                                    <?php if ($item['products']['count'] === 0) { ?>
                                        <td><?php echo $item['products']['count']; ?></td>
                                    <?php } else { ?>
                                        <td><a href="javascript:void(0);" data-name="product"
                                               data-value='<?php echo json_encode($item['products']['details']); ?>'
                                               onclick="showdetails(this);"><?php echo $item['products']['count']; ?></a>
                                        </td>
                                    <?php } ?>

                                </tr>
                                <?php
                                $i++;
                            }
                        }
                        ?>
                        <tr>
                            <td colspan="2">合计</td>
                            <td><?php echo $datas['total']['total_users_count']; ?></td>
                            <td><?php echo $datas['total']['total_members_count']; ?></td>
                            <td><?php echo $datas['total']['total_products_count']; ?></td>
                        </tr>
                    </table>
                    <!-- table end -->
                </div>
            </div>
        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->

    <?php echo $this->mview->getPartial('layouts/_footer') ?>
    <div class="control-sidebar-bg"></div>
</div>

<!-- userdetail-Modal Start -->
<div class="modal fade" id="modal-userdetail" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog" style="width: 680px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    ×
                </button>
                <h4 class="modal-title" id="myModaluserdetail">用户详情：</h4>
            </div>
            <div class="modal-body" id="modal-body-userdetail">
                <div class="bs-example table-responsive" data-example-id="hoverable-table">
                    <table class="table table-hover text-nowrap table-bordered" id="btable-userdetail">
                        <thead>
                        <tr>
                            <th>编号</th>
                            <th>用户名</th>
                            <th>部门</th>
                            <th>组</th>
                            <th>公司</th>
                            <th>性别</th>
                            <th>手机号</th>
                            <th>邮箱</th>
                            <th>地址</th>
                        </tr>
                        </thead>
                        <tbody id="modal-tbody-userdetail"></tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- userdetail-Modal End -->

<!-- memberdetail-Modal Start -->
<div class="modal fade" id="modal-memberdetail" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog" style="width: 680px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    ×
                </button>
                <h4 class="modal-title" id="myModalmemberdetail">会员详情：</h4>
            </div>
            <div class="modal-body" id="modal-body-memberdetail">
                <div class="bs-example table-responsive" data-example-id="hoverable-table">
                    <table class="table table-hover text-nowrap table-bordered" id="btable-memberdetail">
                        <thead>
                        <tr>
                            <th>编号</th>
                            <th>用户名</th>
                            <th>公司</th>
                            <th>性别</th>
                            <th>邮箱</th>
                            <th>手机号</th>
                            <th>地址</th>
                        </tr>
                        </thead>
                        <tbody id="modal-tbody-memberdetail"></tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- memberdetail-Modal End -->

<!-- productdetail-Modal Start -->
<div class="modal fade" id="modal-productdetail" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog" style="width: 680px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    ×
                </button>
                <h4 class="modal-title" id="myModalproductdetail">产品详情：</h4>
            </div>
            <div class="modal-body" id="modal-body-productdetail">
                <div class="bs-example table-responsive" data-example-id="hoverable-table">
                    <table class="table table-hover text-nowrap table-bordered" id="btable-productdetail">
                        <thead>
                        <tr>
                            <th>编号</th>
                            <th>名称</th>
                            <th>国际码</th>
                            <th>系列</th>
                            <th>年代</th>
                            <th>性别</th>
                            <th>品牌</th>
                            <th>品类</th>
                            <th>建档时间</th>
                        </tr>
                        </thead>
                        <tbody id="modal-tbody-productdetail"></tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- productdetail-Modal End -->

</body>
</html>
